ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Partridge_Female Class Reference

The partridge female class. More...

#include <Partridge_All.h>

Inheritance diagram for Partridge_Female:
Partridge_Base TAnimal TALMaSSObject

Public Member Functions

virtual void Dying ()
 General dying handler area. More...
 
virtual void BeginStep (void)
 Female BeginStep. More...
 
virtual void Step (void)
 Female Step. More...
 
virtual void EndStep (void)
 Female EndStep. More...
 
virtual bool DailyMortality ()
 Background mortality check. More...
 
virtual bool OnFarmEvent (FarmToDo event)
 Management event handler. More...
 
void OnMateDying (PartridgeCommunicationData *pc_data)
 Message handler. More...
 
void OnClutchDeath ()
 Message handler. More...
 
void OnClutchMown ()
 Message handler. More...
 
void OnSetMyClutch (PartridgeCommunicationData *pc_data)
 Message handler. More...
 
void OnChicksMatured ()
 Message handler. More...
 
void OnChicksDead ()
 Message handler. More...
 
void OnMating (PartridgeCommunicationData *pc_datae)
 Message handler. More...
 
void OnWaitForMale ()
 Message handler. More...
 
void OnEggsHatch ()
 Message handler. More...
 
int GetClutchSize (void)
 ´Supply clutch size More...
 
Partridge_ClutchGetClutch (void)
 Supply clutch pointer. More...
 
Partridge_MaleGetMate (void)
 Supply mate pointer. More...
 
void UnSetMate (void)
 Forget mate. More...
 
virtual bool ArePaired ()
 Are we paired? More...
 
virtual void KillThis ()
 Direct mortality message. More...
 
Partridge_MaleGetOldMate (void)
 Supply old mate pointer. More...
 
void SetOldMate (Partridge_Male *pm)
 Set old mate pointer. More...
 
void RemoveOldMate (bool a_knockon)
 Forget old mate. More...
 
 Partridge_Female (int a_born_x, int a_born_y, int a_x, int a_y, Partridge_Covey *a_flock, Landscape *a_map, int a_family_counter, Partridge_Population_Manager *a_manager)
 Constructor. More...
 
virtual ~Partridge_Female (void)
 Destructor. More...
 
bool HaveTerritory (void)
 Have we a breeding 'territory'? More...
 
- Public Member Functions inherited from Partridge_Base
Partridge_Object GetObjectType ()
 Supply object type. More...
 
bool GetUncleStatus ()
 Supply uncle status. More...
 
void SetUncleStatus (bool a_Status)
 Set uncle status. More...
 
bool PossibleMate (Partridge_Base *a_partridge)
 Can we mate? More...
 
Partridge_CoveyGetCovey (void)
 Supply covey pointer. More...
 
Partridge_State GetState (void)
 Supply state. More...
 
void SetState (Partridge_State a_pars)
 Set state. More...
 
int GetFamily (void)
 Supply family ID. More...
 
int GetAge (void)
 Supply age. More...
 
void SetAge (int a_age)
 Set age. More...
 
long GetID (void)
 Supply ID. More...
 
void SetFamily (unsigned int family)
 Set family ID. More...
 
void SetCovey (Partridge_Covey *a_covey)
 Set covey pointer. More...
 
void MakeCovey ()
 Create our own covey. More...
 
void SwitchCovey (Partridge_Covey *a_covey)
 Swap coveys. More...
 
 Partridge_Base (int a_born_x, int a_born_y, int a_x, int a_y, int a_family_counter, Partridge_Covey *a_covey, Landscape *a_map, Partridge_Population_Manager *a_manager)
 Constructor for Partridge_Base. More...
 
virtual ~Partridge_Base (void)
 Destructor. More...
 
virtual void CopyMyself (int a_Ptype)
 Duplicate this object. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

Partridge_State FFlocking (void)
 Female flocking state. More...
 
Partridge_State FPairing (void)
 Female pairing state. More...
 
Partridge_State FBuildingUpResources (void)
 Female building up resources state. More...
 
Partridge_State FMakingNest (void)
 Female making nest state. More...
 
Partridge_State FLaying (void)
 Female laying state. More...
 
Partridge_State FStartingNewBrood (bool a_waslaying)
 Female starting new brood state. More...
 
Partridge_State FIncubating (void)
 Female incubating state. More...
 
Partridge_State FCaringForYoung (void)
 Female caring for young state. More...
 
Partridge_State FFindingTerritory (void)
 Female finding 'territory' state. More...
 
Partridge_State FAttractingMate (void)
 Female attracting mate state. More...
 
void FDying (void)
 
virtual void CheckMatePointers ()
 Debug function - checking mate consistency
More...
 
double GetNestingCoverDensity ()
 Calls Partridge_Population_Manager::GetNestingCoverDensity
More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

bool m_HaveTerritory
 Flag for having found a suitable breeding area. More...
 
bool m_clutchproduced
 Flag for having produced a clutch. More...
 
int m_clutch_size
 Current clutch size. More...
 
int m_clutch_number
 Current clutch attempt. More...
 
int m_nest_counter
 Days spent nest building. More...
 
int m_lifespan
 Physiological lifespan in days. More...
 
int m_triggerlayingvar
 Adds stochasticity to the light triggering of breeding. More...
 
int m_startlayingday
 Records the day laying started. More...
 
int m_buildupwait
 Delay before breeding can commence. More...
 
Partridge_Malem_MyMate
 A pointer to the current mate if any. More...
 
Partridge_Malem_MyOldHusband
 A record of the previous mate if any. More...
 
Partridge_Clutchm_MyClutch
 A pointer to any current clutch. More...
 
- Protected Attributes inherited from Partridge_Base
int m_signal
 Used to pass information to outputs. More...
 
long m_id
 Individual bird ID. More...
 
int m_family_counter
 Family ID. More...
 
int m_age
 Age in days. More...
 
int m_born_x
 x-coord of birth More...
 
int m_born_y
 y-coord of birth More...
 
bool m_UncleStatus
 If has uncle status in the covey. More...
 
Partridge_Object m_object_type
 Type of pob object this is. More...
 
Partridge_Coveym_covey
 Pointer to the covey. More...
 
Partridge_State m_state
 Current behavioural state. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Additional Inherited Members

- Public Attributes inherited from Partridge_Base
Partridge_Population_Managerm_OurPopulationManager
 Pointer to the population manager. More...
 

Detailed Description

The partridge female class.

Constructor & Destructor Documentation

◆ Partridge_Female()

Partridge_Female::Partridge_Female ( int  a_born_x,
int  a_born_y,
int  a_x,
int  a_y,
Partridge_Covey a_covey,
Landscape a_map,
int  a_family_counter,
Partridge_Population_Manager a_manager 
)

Constructor.

Constructor - ensures that attributes are set to sensible starting values, otherwise uses the Partridge_Base constructor.

1335  :
1336  Partridge_Base( a_born_x, a_born_y, a_x, a_y, a_family_counter, a_covey, a_map, a_manager )
1337  {
1338  m_MyMate = NULL;
1339  m_HaveTerritory = false;
1341  m_MyOldHusband=NULL;
1342  m_MyClutch = NULL;
1343  m_clutch_size = 0;
1346 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
static CfgInt cfg_par_triggerlayingvar("PAR_TRIGGERLAYINGVAR", CFG_CUSTOM, 48)
Generates variation around the laying trigger.
CfgInt cfg_par_min_lifespan("PAR_MIN_LIFESPAN", CFG_CUSTOM, 1825)
Minimum physiological lifespan.
CfgInt cfg_par_max_lifespan("PAR_MAX_LIFESPAN", CFG_CUSTOM, 3650)
Maximum physiological lifespan.
@ pob_Female
Definition: Partridge_All.h:297
int value(void)
Definition: configurator.h:98
Partridge_Object m_object_type
Type of pob object this is.
Definition: Partridge_All.h:418
Partridge_Base(int a_born_x, int a_born_y, int a_x, int a_y, int a_family_counter, Partridge_Covey *a_covey, Landscape *a_map, Partridge_Population_Manager *a_manager)
Constructor for Partridge_Base.
Definition: Partridge_All.cpp:156
int m_triggerlayingvar
Adds stochasticity to the light triggering of breeding.
Definition: Partridge_All.h:813
Partridge_Male * m_MyOldHusband
A record of the previous mate if any.
Definition: Partridge_All.h:821
bool m_HaveTerritory
Flag for having found a suitable breeding area.
Definition: Partridge_All.h:801
int m_lifespan
Physiological lifespan in days.
Definition: Partridge_All.h:811
Partridge_Clutch * m_MyClutch
A pointer to any current clutch.
Definition: Partridge_All.h:823
Partridge_Male * m_MyMate
A pointer to the current mate if any.
Definition: Partridge_All.h:819
int m_clutch_size
Current clutch size.
Definition: Partridge_All.h:805

References cfg_par_max_lifespan, cfg_par_min_lifespan, cfg_par_triggerlayingvar, m_clutch_size, m_HaveTerritory, m_lifespan, m_MyClutch, m_MyMate, m_MyOldHusband, Partridge_Base::m_object_type, m_triggerlayingvar, pob_Female, random(), and CfgInt::value().

◆ ~Partridge_Female()

virtual Partridge_Female::~Partridge_Female ( void  )
inlinevirtual

Destructor.

917 {;}

Member Function Documentation

◆ ArePaired()

virtual bool Partridge_Female::ArePaired ( )
inlinevirtual

Are we paired?

Reimplemented from Partridge_Base.

882  {
883  if (m_MyMate!=NULL) return true;
884  return false;
885  }

References m_MyMate.

◆ BeginStep()

void Partridge_Female::BeginStep ( void  )
virtual

Female BeginStep.

The BeginStep code for the female partridge. Only function is the test for mortality of different kinds. Might as well remove her here than waste CPU time thinking about the Step code later this time-step.

Reimplemented from TAnimal.

1355 {
1356  m_age++; // Get a day older
1357  if ( m_age >= m_lifespan )
1358  {
1359  m_signal = 0; // Too old
1360  FDying();
1361  }
1362  else if ( !DailyMortality() ) CheckManagement();
1363  else
1364  {
1365  m_signal = 1; // Killed
1366  }
1367 #ifdef __PAR_DEBUG
1369 #endif
1370 }
int m_age
Age in days.
Definition: Partridge_All.h:410
int m_signal
Used to pass information to outputs.
Definition: Partridge_All.h:404
virtual bool DailyMortality()
Background mortality check.
Definition: Partridge_All.cpp:1454
void FDying(void)
Definition: Partridge_All.cpp:1984
virtual void CheckMatePointers()
Debug function - checking mate consistency
Definition: Partridge_All.cpp:2827
void CheckManagement(void)
Definition: PopulationManager.cpp:1404

References TAnimal::CheckManagement(), CheckMatePointers(), DailyMortality(), FDying(), Partridge_Base::m_age, m_lifespan, and Partridge_Base::m_signal.

◆ CheckMatePointers()

void Partridge_Female::CheckMatePointers ( )
protectedvirtual

Debug function - checking mate consistency

This is a debug function.

Reimplemented from Partridge_Base.

2828 {
2829  //**CJT** DEBUG
2830  if ( m_MyMate )
2831  {
2832  // Check for mutual pointers here
2833  if ( m_MyMate->GetMate() != this )
2834  {
2835  m_OurLandscape->Warn( "Partridge_Female::CheckMatePointers(): ""Non-mutual mate pointers", "" );
2836  exit( 1 );
2837  }
2838  if ( m_state == pars_FFlocking )
2839  {
2840  m_OurLandscape->Warn( "Partridge_Female::CheckMatePointers(): ""Mated & Flocking", "" );
2841 
2842  exit( 1 );
2843  }
2844  if ( m_MyMate->GetCurrentStateNo() == -1 )
2845  {
2846  m_OurLandscape->Warn( "Partridge_Female::CheckMatePointers(): ""Dead Mate", "" );
2847  exit( 1 );
2848  }
2849  }
2850 }
@ pars_FFlocking
Definition: Partridge_All.h:282
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Partridge_State m_state
Current behavioural state.
Definition: Partridge_All.h:422
Partridge_Female * GetMate(void)
Are we paired?
Definition: Partridge_All.h:719
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References TALMaSSObject::GetCurrentStateNo(), Partridge_Male::GetMate(), m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_state, pars_FFlocking, and Landscape::Warn().

Referenced by BeginStep(), FBuildingUpResources(), FFindingTerritory(), FMakingNest(), FStartingNewBrood(), and Step().

◆ DailyMortality()

bool Partridge_Female::DailyMortality ( void  )
virtual

Background mortality check.

This method is responsible for applying a general mortality, ie not explicitly modelled. There are three periods considered, a spring mortality applied during 'territory' finding (see Partridge_Female::FFindingTerritory), a winter mortality applied daily between October and April, and the rest of the year a summer mortality. In addition there is a scaling factor (extramort) which is applied if the bird is alone. All parameter values are under user control through configuration variables.

Reimplemented from Partridge_Base.

1455 {
1456  bool dead = false;
1457  double chance = g_rand_uni();
1458  double extramort=1.0;
1459  if ( m_covey->GetCoveySize() == 1 ) {
1461  }
1462  int today = m_OurLandscape->SupplyDayInYear();
1464  if ( chance < cfg_par_adult_mortalitySpring.value()*extramort ) dead = true;
1465  }
1466  else {
1467  // Is it winter?
1468  if ( ( today >= October ) || ( today < April ) ) {
1469  // We are in the "Winter Period"
1470  if ( chance < cfg_par_adult_mortalityWinter.value()*extramort ) dead = true;
1471  }
1472  else // Not winter and not finding territory
1473  {
1474  if ( chance < (cfg_par_adult_mortalitySummer.value()*extramort) ) dead = true;
1475  }
1476  }
1477  if ( dead ) {
1478  FDying();
1479  return true;
1480  }
1481  return false;
1482 }
static CfgFloat cfg_par_adult_mortalitySummer("PAR_ADULT_MORTALITYSUMMER", CFG_CUSTOM, 0.0001)
Adults - daily probability of non-explicitly modelled mortality in Summer.
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
static CfgFloat cfg_par_adult_mortalityWinter("PAR_ADULT_MORTALITYWINTER", CFG_CUSTOM, 0.0217)
Adults - daily probability of non-explicitly modelled mortality in Winter.
static CfgFloat cfg_par_adult_mortalitySpring("PAR_ADULT_MORTALITYSPRING", CFG_CUSTOM, 0.0096)
Adults - daily probability of non-explicitly modelled mortality in Spring.
static CfgFloat cfg_par_adult_mortality_alone("PAR_ADULT_MORTALITY_ALONE", CFG_CUSTOM, 1.4)
Adults - extra mortality scaler if alone.
@ pars_FFindingTerritory
Definition: Partridge_All.h:282
double value(void)
Definition: configurator.h:118
int SupplyDayInYear(void)
Definition: landscape.h:1596
Partridge_Covey * m_covey
Pointer to the covey.
Definition: Partridge_All.h:420
unsigned int GetCoveySize()
Return the covey size.
Definition: Partridge_Covey.h:476
const int October
Definition: landscape.h:45
const int April
Definition: landscape.h:39

References April, cfg_par_adult_mortality_alone, cfg_par_adult_mortalitySpring, cfg_par_adult_mortalitySummer, cfg_par_adult_mortalityWinter, FDying(), g_rand_uni, Partridge_Covey::GetCoveySize(), Partridge_Base::m_covey, TAnimal::m_OurLandscape, Partridge_Base::m_state, October, pars_FFindingTerritory, Landscape::SupplyDayInYear(), and CfgFloat::value().

Referenced by BeginStep().

◆ Dying()

virtual void Partridge_Female::Dying ( )
inlinevirtual

General dying handler area.

Reimplemented from TAnimal.

827  {
828  FDying();
829  }

References FDying().

◆ EndStep()

void Partridge_Female::EndStep ( void  )
virtual

Female EndStep.

Nothing to do.

Reimplemented from TAnimal.

1442 {
1443 #ifdef __PAR_DEBUG
1444 #endif
1445 }

◆ FAttractingMate()

Partridge_State Partridge_Female::FAttractingMate ( void  )
protected

Female attracting mate state.

This just loops because it is the male who controls this. She will stay doing this until either she is pulled out by a male arriving or give up breeding date is reached.
During this period her covey peg is locked in position following Partridge_Female::FFindingTerritory, so she cannot be moved by other covies.

1963 {
1969  {
1970  return pars_FAttractingMate;
1971  }
1972  else
1973  {
1974  // Unlock covey 'peg'.
1975  m_covey->SetFixed( false );
1976  return pars_FFlocking;
1977  }
1978 }
@ pars_FAttractingMate
Definition: Partridge_All.h:283
Partridge_Population_Manager * m_OurPopulationManager
Pointer to the population manager.
Definition: Partridge_All.h:430
void SetFixed(bool a_is_fixed)
Prevent/enable peg drift.
Definition: Partridge_Covey.h:572
bool SupplyShouldFlock()
Definition: Partridge_Population_Manager.h:286

References Partridge_Base::m_covey, Partridge_Base::m_OurPopulationManager, pars_FAttractingMate, pars_FFlocking, Partridge_Covey::SetFixed(), and Partridge_Population_Manager::SupplyShouldFlock().

Referenced by Step().

◆ FBuildingUpResources()

Partridge_State Partridge_Female::FBuildingUpResources ( void  )
protected

Female building up resources state.

This is simply a waiting state where we assume the female is building up physiologial resources before breeding. Since we don't know what triggers this we origianlly used a fixed counter from the point were territory has been fixed. This produced variation in the starting laying date determined by when the pair fixes their breeding territory for this season. However this did not seem satisfactory so it has been replaced with a measure of daylength with variation.

1645 {
1646 #ifdef __PAR_DEBUG
1648  /* if ( m_nest_counter < 1 ) { exit( 0 ); } */
1649 #endif
1650  // Note that with default settings the m_buildupwait is always gong to be 0 or less on calling this method.
1651  if (--m_buildupwait < 0) {
1652  // daylength que from when they start the covey dissolve
1653  // This could be altered to include bad weather delays
1655  {
1657  return pars_FMakingNest;
1658  }
1659  }
1661 }
static CfgInt cfg_par_days_to_make_nest("PAR_DAYS_TO_MAKE_NEST", CFG_CUSTOM, 5)
Days used for nestbuilding.
static CfgInt cfg_par_triggerlaying("PAR_TRIGGERLAYING", CFG_CUSTOM, 850)
The number of minutes daylight as a minimum before triggering egg-laying behaviour.
@ pars_FBuildingUpResources
Definition: Partridge_All.h:282
@ pars_FMakingNest
Definition: Partridge_All.h:282
int SupplyDaylength(void)
Definition: landscape.h:1530
int m_nest_counter
Days spent nest building.
Definition: Partridge_All.h:809
int m_buildupwait
Delay before breeding can commence.
Definition: Partridge_All.h:817

References cfg_par_days_to_make_nest, cfg_par_triggerlaying, CheckMatePointers(), m_buildupwait, m_nest_counter, TAnimal::m_OurLandscape, m_triggerlayingvar, pars_FBuildingUpResources, pars_FMakingNest, Landscape::SupplyDaylength(), and CfgInt::value().

Referenced by Step().

◆ FCaringForYoung()

Partridge_State Partridge_Female::FCaringForYoung ( void  )
protected

Female caring for young state.

Will stay in this state until her young counter is zero - this is caused by messages from the young, so nothing to do but wait. Distance move is calculated as a function of chick food needs, so uses chick age.

1897 {
1898  int ch_age = m_covey->GetChickAge();
1899  m_covey->MoveDistance( g_MaxWalk[ch_age], 10, 10000 );
1900  return pars_FCaringForYoung;
1901 }
int g_MaxWalk[200]
Definition: Partridge_Population_Manager.cpp:66
@ pars_FCaringForYoung
Definition: Partridge_All.h:283
int GetChickAge()
Return chick age.
Definition: Partridge_Covey.h:486
void MoveDistance(int a_max_distance, int a_step_size, double a_food_density_needed)
Entry point for movement.
Definition: Partridge_Covey.cpp:652

References g_MaxWalk, Partridge_Covey::GetChickAge(), Partridge_Base::m_covey, Partridge_Covey::MoveDistance(), and pars_FCaringForYoung.

Referenced by Step().

◆ FDying()

void Partridge_Female::FDying ( void  )
protected

Must do all the clean-up necessary to remove the female from the simulation without leaving any stray pointers to this object.

1985 {
1986  if ( m_CurrentStateNo == -1 ) return; // Don't kill me twice
1987  // Do I have kids? - dont' care - taken care of by covey
1988  // Do I have a clutch & mate, if so tell them
1993  m_MyMate = NULL;
1994  RemoveOldMate(false);
1995  m_CurrentStateNo = -1;
1996  m_StepDone = true;
1997  m_covey->NestLeave(); // Just in case this is not already done
1998  m_covey->RemoveMember( this );
2000  // Output as necessary
2002  //m_covey->SanityCheck2(m_covey->GetOurChicks() );
2003  // m_OurPopulationManager->WriteParAdMort( m_OurLandscape->SupplyGlobalDate(), m_age, 1, m_signal );
2004 }
@ pars_Destroy
Definition: Partridge_All.h:287
@ pcomm_MumDeadC
Definition: Partridge_Communication.h:66
bool PassMessage(PartridgeCommunicationData *pc_data, TypeOfPartridge_Communication pc)
Pass a message.
Definition: Partridge_Communication.cpp:86
void NestLeave(void)
Leave the nest
Definition: Partridge_Covey.h:516
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
Definition: Partridge_Covey.cpp:1664
void RemoveOldMate(bool a_knockon)
Forget old mate.
Definition: Partridge_All.h:903
k_factors * m_Ourkfactors
Pointer to kfactors object.
Definition: Partridge_Population_Manager.h:169
Partridge_Communication m_messagecentre
Message class pointer.
Definition: Partridge_Population_Manager.h:163
PartridgeCommunicationData * m_comms_data
Message data.
Definition: Partridge_Population_Manager.h:161
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
population_attributes * m_ThisYear
Definition: Partridge_All.h:251
void incNoDeadFemales()
Definition: Partridge_All.h:172
Partridge_Female * m_female
Definition: Partridge_Communication.h:84
Partridge_Male * m_male
Definition: Partridge_Communication.h:83
Partridge_Clutch * m_clutch
Definition: Partridge_Communication.h:80

References population_attributes::incNoDeadFemales(), PartridgeCommunicationData::m_clutch, Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, TALMaSSObject::m_CurrentStateNo, PartridgeCommunicationData::m_female, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyClutch, m_MyMate, Partridge_Population_Manager::m_Ourkfactors, Partridge_Base::m_OurPopulationManager, Partridge_Base::m_state, TALMaSSObject::m_StepDone, k_factors::m_ThisYear, Partridge_Covey::NestLeave(), pars_Destroy, Partridge_Communication::PassMessage(), pcomm_MumDeadC, Partridge_Covey::RemoveMember(), and RemoveOldMate().

Referenced by BeginStep(), DailyMortality(), Dying(), FIncubating(), KillThis(), OnClutchMown(), and OnFarmEvent().

◆ FFindingTerritory()

Partridge_State Partridge_Female::FFindingTerritory ( void  )
protected

Female finding 'territory' state.

Territory here is used to mean a place where breeding is possible and not a territory in the normal definition of a defended area.

First we have to be sure we are not too late in the year, if so start flocking.
Next we make a movement using Partridge_Covey::FlyTo and determine the quality of the territory compared to a minimum acceptable quality.
Next we check whether this area is already occupied by a covey. If this is OK then we settle here. If we fail at any of these steps then we have 49 more tries in this time-step before giving up until the next day.

1913 {
1914  // First check that we are not too late in the year
1916  if ( m_MyMate ) {
1920  m_MyMate = NULL;
1921  }
1922  m_covey->SetFixed( false ); // ensure we do not have a fixed territory loc
1923  return pars_FFlocking;
1924  }
1925  int steps = 0;
1926  do {
1928  // OK so ask the covey about quality here
1929  double q = m_covey->AssessHabitatQualityFaster();
1930  int today = m_OurLandscape->SupplyDayInYear();
1931  int dayspast = today - cfg_par_start_dissolve.value(); // start day as soon as covey dissolve starts to happen
1932  double terr_score = m_OurPopulationManager->GetHabitatQuality(dayspast);
1933  // Test whether the score is above the minimum quality required.
1934  if ( q > terr_score )
1935  {
1936  // Is the covey too close to another, therefore this location is unsuitable?
1937  if ( !m_covey->TooClose() ) {
1938  m_HaveTerritory = true;
1939  m_covey->FixHabitat();
1940  m_covey->SetFixed( true ); // Can read this with IsFixed()
1941  #ifdef __PAR_DEBUG
1943  #endif
1944  m_clutch_number = 0;
1945  if ( !m_MyMate ) return pars_FAttractingMate;
1946  else {
1947  // No need to tell the male, he will check the m_HaveTerritory flag
1950  }
1951  }
1952  }
1953  }
1954  } while ( ++steps < 50 ); // this many goes per day
1955  m_HaveTerritory = false;
1956  // try again tomorrow
1957  return pars_FFindingTerritory;
1958 }
static CfgInt cfg_buildupwait("PAR_BUILDUP_WAIT", CFG_CUSTOM, 130)
Time period after finding territory before making nest.
CfgInt cfg_par_start_dissolve("PAR_START_DISSOLVE", CFG_CUSTOM, 30)
The earliest covey dissolve date.
Definition: Partridge_Population_Manager.cpp:94
static CfgInt cfg_par_female_movement_max("PAR_FEMALE_MOVEMENT_MAX", CFG_CUSTOM, 100)
Female max daily movement.
@ pcomm_FemaleGivingUp
Definition: Partridge_Communication.h:67
void FixHabitat(void)
Accept this breeding location.
Definition: Partridge_Covey.cpp:1074
bool FlyTo(int a_distance)
Fly to
Definition: Partridge_Covey.cpp:1484
bool TooClose()
Test for another covey too close.
Definition: Partridge_Covey.cpp:1271
double AssessHabitatQualityFaster()
Assess habitat quality (efficient)
Definition: Partridge_Covey.cpp:1068
int m_clutch_number
Current clutch attempt.
Definition: Partridge_All.h:807
double GetHabitatQuality(int a_day)
Definition: Partridge_Population_Manager.h:304

References Partridge_Covey::AssessHabitatQualityFaster(), cfg_buildupwait, cfg_par_female_movement_max, cfg_par_start_dissolve, CheckMatePointers(), Partridge_Covey::FixHabitat(), Partridge_Covey::FlyTo(), Partridge_Population_Manager::GetHabitatQuality(), m_buildupwait, m_clutch_number, Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, PartridgeCommunicationData::m_female, m_HaveTerritory, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, pars_FAttractingMate, pars_FBuildingUpResources, pars_FFindingTerritory, pars_FFlocking, Partridge_Communication::PassMessage(), pcomm_FemaleGivingUp, random(), Partridge_Covey::SetFixed(), Landscape::SupplyDayInYear(), Partridge_Population_Manager::SupplyShouldFlock(), Partridge_Covey::TooClose(), and CfgInt::value().

Referenced by Step().

◆ FFlocking()

Partridge_State Partridge_Female::FFlocking ( void  )
protected

Female flocking state.

Ensures that the covey is moving around while flocking. NB: It is OK for all the members of the covey to call this method every day. It only has any effect on the first call.
The birds wait in this state until they get a message initiating breeding behaviour.

1633 {
1635  return pars_FFlocking;
1636 }
int GetmaxAllowedMove()
Return the max possible move distance today.
Definition: Partridge_Covey.h:411
double GetmaxFoodNeedToday()
Return the maximum food need today.
Definition: Partridge_Covey.h:416

References Partridge_Covey::GetmaxAllowedMove(), Partridge_Covey::GetmaxFoodNeedToday(), Partridge_Base::m_covey, Partridge_Covey::MoveDistance(), and pars_FFlocking.

Referenced by Step().

◆ FIncubating()

Partridge_State Partridge_Female::FIncubating ( void  )
protected

Female incubating state.

Arrives here from Laying, and stays until either the clutch tells her its hatched, or the clutch is dead - so just wait unless eaten via density-dependent mortality depending upon the number of nests nearby. NB this is a local density-dependence.

1857 {
1859  { // only the eggs
1864  m_covey->NestLeave();
1865  m_state = FStartingNewBrood( false );
1866  m_MyClutch = NULL;
1867  return m_state;
1868  }
1869  // Only need to calculate the heavy bit if the nest survives egg predation
1870  double dens = 0.000001 + m_OurPopulationManager->ClutchDensity( m_covey->X(), m_covey->Y(), 500 );
1871  // Have use DPotts idea as the basis but modified this to account for the local rather than global density.
1872  double todaysmortchance = cfg_par_female_incubation_mortality_const.value()
1873  - ( pow( (double) dens, (double) cfg_par_female_incubation_mortality_slope.value() ) );
1874  todaysmortchance *= 100000;
1875  if ( random( 100000 ) < todaysmortchance )
1876  {
1877  // both eaten
1878  FDying();
1879  // Register the death with k_factors
1882  m_covey->NestLeave();
1883  return pars_FDying; // This does nothing actually
1884  }
1885  return pars_FIncubating;
1886 }
static CfgFloat cfg_par_clutch_mortality("PAR_CLUTCH_MORTALITY", CFG_CUSTOM, 0.00135)
Clutch - daily probability of non-explicitly modelled mortality.
static CfgFloat cfg_par_female_incubation_mortality_slope("PAR_FEMALE_INCUBATION_MORTALITY_SLOPE", CFG_CUSTOM, -0.00122)
Increasing hen predation with density (slope)
static CfgFloat cfg_par_female_incubation_mortality_const("PAR_FEMALE_INCUBATION_MORTALITY_CONST", CFG_CUSTOM, 1.00192)
Increasing hen predation with density (intercept)
@ pars_FIncubating
Definition: Partridge_All.h:283
@ pars_FDying
Definition: Partridge_All.h:283
@ pcomm_ClutchEaten
Definition: Partridge_Communication.h:68
unsigned int Y(void)
Definition: Partridge_Covey.h:713
unsigned int X(void)
Definition: Partridge_Covey.h:708
Partridge_State FStartingNewBrood(bool a_waslaying)
Female starting new brood state.
Definition: Partridge_All.cpp:1802
int ClutchDensity(int x, int y, int radius)
Returns clutch density at x,y with radius radius.
Definition: Partridge_Population_Manager.cpp:569
void incNoHensPredated()
Definition: Partridge_All.h:104
void incNoClutchesPredated()
Definition: Partridge_All.h:100

References cfg_par_clutch_mortality, cfg_par_female_incubation_mortality_const, cfg_par_female_incubation_mortality_slope, Partridge_Population_Manager::ClutchDensity(), FDying(), FStartingNewBrood(), g_rand_uni, population_attributes::incNoClutchesPredated(), population_attributes::incNoHensPredated(), PartridgeCommunicationData::m_clutch, Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, PartridgeCommunicationData::m_female, Partridge_Population_Manager::m_messagecentre, m_MyClutch, Partridge_Population_Manager::m_Ourkfactors, Partridge_Base::m_OurPopulationManager, Partridge_Base::m_state, k_factors::m_ThisYear, Partridge_Covey::NestLeave(), pars_FDying, pars_FIncubating, Partridge_Communication::PassMessage(), pcomm_ClutchEaten, random(), CfgFloat::value(), Partridge_Covey::X(), and Partridge_Covey::Y().

Referenced by Step().

◆ FLaying()

Partridge_State Partridge_Female::FLaying ( void  )
protected

Female laying state.

Need to add eggs to clutch, here the problem is that eggs are not produced one each day We have: cfg_par_days_per_egg.value() and m_clutch_size and m_startlayingday so we just add one egg each cfg_par_days_per_egg.value() days until we have the size wee need.
If she completes her laying this is counted as a success and the female remembers the male as a good mate and makes a transition to FIncubating.

1769 {
1770  // 24th Jan 2008 CJT added the code below to allow for clutch predation before clutch completion
1771  if ( g_rand_uni() < cfg_par_clutch_mortality.value() ) { // only the eggs
1776  m_covey->NestLeave(); // Should not strictly be necessary, but safe
1777  m_state = FStartingNewBrood( true );
1778  m_MyClutch = NULL;
1779  return m_state;
1780  }
1782  int cs = (int) (days / cfg_par_days_per_egg.value());
1784  if (cs<m_clutch_size) return pars_FLaying;
1785  else {
1786  // Remember this male as a good mate
1788  m_MyMate->SetOldMate(this);
1791  return pars_FIncubating;
1792  }
1793 }
static CfgFloat cfg_par_days_per_egg("PAR_DAY_PER_EGG", CFG_CUSTOM, 1.5)
Days taken to lay 1 egg.
@ pars_FLaying
Definition: Partridge_All.h:282
long SupplyGlobalDate(void)
Definition: landscape.h:1621
void SetClutchSize(int cs)
Set no. eggs.
Definition: Partridge_All.h:556
void OnStartIncubating()
Flag under incubation.
Definition: Partridge_All.h:536
void SetOldMate(Partridge_Male *pm)
Set old mate pointer.
Definition: Partridge_All.h:898
int m_startlayingday
Records the day laying started.
Definition: Partridge_All.h:815
void SetOldMate(Partridge_Female *pf)
Set old mate pointer.
Definition: Partridge_All.h:752
void WriteParClutches(int a_min, int a_num1, int a_num2)
Output method.
Definition: Partridge_Population_Manager.cpp:1682

References cfg_par_clutch_mortality, cfg_par_days_per_egg, FStartingNewBrood(), g_rand_uni, population_attributes::incNoClutchesPredated(), PartridgeCommunicationData::m_clutch, m_clutch_number, m_clutch_size, Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, PartridgeCommunicationData::m_female, Partridge_Population_Manager::m_messagecentre, m_MyClutch, m_MyMate, Partridge_Population_Manager::m_Ourkfactors, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, m_startlayingday, Partridge_Base::m_state, k_factors::m_ThisYear, Partridge_Covey::NestLeave(), Partridge_Clutch::OnStartIncubating(), pars_FIncubating, pars_FLaying, Partridge_Communication::PassMessage(), pcomm_ClutchEaten, Partridge_Clutch::SetClutchSize(), Partridge_Male::SetOldMate(), SetOldMate(), Landscape::SupplyDayInYear(), Landscape::SupplyGlobalDate(), CfgFloat::value(), and Partridge_Population_Manager::WriteParClutches().

Referenced by Step().

◆ FMakingNest()

Partridge_State Partridge_Female::FMakingNest ( void  )
protected

Female making nest state.

We start with a test for the end of the breeding season. If it is not too late then we determine the eventual size of the clutch here and create this when the nest is completed. The clutch object is created with zero eggs and the eggs are added in Partridge_Female::FLaying.
Determining the number of eggs to be produced has been done by fitting a curve to Danish data from 1953 since we do not know how to do this mechanistically:

Clutch size with fitted curve used to create a probability distribution hard-coded below. This distribution is scaled up and down to obtain the correct mean clutch size recorded when parameter fitting.
The male will just carry on guarding so no need to tell him when the nest is complete. Originally needed to do a special calculation here to calculate the km nesting cover/km2 present. This does not change during the nest's existence so no danger of errors there and this code was slow so an alternative was to calculate all possible values on a coarser grid at start of simulation, then store these - this is the current implementation.

1674 {
1675  //
1677  {
1678  if ( m_MyMate )
1679  {
1683  }
1684  // No success so clear the oldmate
1685  RemoveOldMate(false);
1686  m_MyMate = NULL;
1687  m_covey->SetFixed( false );
1688  m_HaveTerritory = false;
1689  return pars_FFlocking;
1690  }
1691  // data
1692  const int clutchsize[19] =
1693  {
1694  // This array holds the probabilities of clutch sizes in 20 categories.
1695  // below from Damerham
1696  143, 385, 725, 1163, 1700, 2336, 3070, 3902, 4833, 5863, 6990, 8217, 9037, 9607, 9928, 10000, 10000, 10000
1697  // The data below is from fitting a 3rd order polynomial to the Danish Paludan 1953 for Danish conditions
1698  // 48, 198, 451, 807, 1266, 1828, 2493, 3261, 4132, 5106, 6182, 7361, 8416, 9208, 9736, 10000, 10000, 10000
1699  };
1700  if ( --m_nest_counter == 0 ) {
1701  if ( m_clutch_size == 0 )
1702  { // If it is not zero it must be 2nd brood and is already set so don't alter it
1703  int chance = random( 10000 );
1704  for ( int i = 0; i < 19; i++ )
1705  {
1706  if ( clutchsize[i] > chance )
1707  {
1709  break;
1710  }
1711  }
1712  }
1713 #ifdef __PAR_DEBUG
1715  if ( m_OurLandscape->SupplyDayInYear() > 200 )
1716  {
1717  int rubbish = 0;
1718  }
1719 #endif
1720  // NOW MAKE THE NEST
1721  // Find and move to a nest location
1722  bool fnd = m_covey->NestFindLocation();
1723  if ( !fnd )
1724  {
1725  // No nest site - no breeding here
1726  // so find another territory
1727  // Tell the male too
1728  if ( m_MyMate )
1729  {
1733  }
1734  return pars_FFindingTerritory;
1735  }
1736  unsigned int family = m_family_counter + 1;
1737  // Make a clutch object
1738  Clutch_struct * ac;
1739  ac = new Clutch_struct;
1740  ac->x = m_Location_x;
1741  ac->y = m_Location_y;
1742  ac->bx = m_Location_x;
1743  ac->by = m_Location_y;
1744  ac->Mum = this;
1745  ac->No = 1; // Was clutch size but 24/01/08 the nest is built first then slowly filled. // m_clutch_size;
1746  ac->family_counter = family;
1747  ac->m_covey = m_covey;
1749  delete ac;
1750  if ( m_clutchproduced )
1751  {
1752  // This must be a re-lay, so don't count it towards total clutches laid
1754  }
1755  m_clutchproduced = true;
1757  return pars_FLaying;
1758  }
1759  return pars_FMakingNest;
1760 }
static CfgInt cfg_par_min_no_eggs("PAR_MIN_NO_EGGS", CFG_CUSTOM, 7)
Minimum clutch size.
CfgInt cfg_par_last_brood_date("PAR_LAST_BROOD_DATE", CFG_CUSTOM, 180)
Latest date for a reproduction attempt.
@ pob_Clutch
Definition: Partridge_All.h:297
@ pcomm_StoppingBreeding
Definition: Partridge_Communication.h:69
@ pcomm_MovingHome
Definition: Partridge_Communication.h:70
Struct to pass clutch information.
Definition: Partridge_All.h:362
Partridge_Female * Mum
Definition: Partridge_All.h:365
int No
Definition: Partridge_All.h:364
int m_family_counter
Family ID.
Definition: Partridge_All.h:408
bool NestFindLocation(void)
Try to locate a suitable nesting location.
Definition: Partridge_Covey.cpp:1107
bool m_clutchproduced
Flag for having produced a clutch.
Definition: Partridge_All.h:803
void CreateObjects(int ob_type, Partridge_struct *data, int number)
Definition: Partridge_Population_Manager.cpp:368
int by
Definition: Partridge_All.h:347
Partridge_Covey * m_covey
Definition: Partridge_All.h:349
int x
Definition: Partridge_All.h:344
int bx
Definition: Partridge_All.h:346
int y
Definition: Partridge_All.h:345
int family_counter
Definition: Partridge_All.h:350
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
void decNoClutches()
Definition: Partridge_All.h:91

References Partridge_struct::bx, Partridge_struct::by, cfg_par_last_brood_date, cfg_par_min_no_eggs, CheckMatePointers(), Partridge_Population_Manager::CreateObjects(), population_attributes::decNoClutches(), Partridge_struct::family_counter, m_clutch_size, m_clutchproduced, Partridge_Population_Manager::m_comms_data, Partridge_struct::m_covey, Partridge_Base::m_covey, Partridge_Base::m_family_counter, PartridgeCommunicationData::m_female, m_HaveTerritory, TAnimal::m_Location_x, TAnimal::m_Location_y, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyMate, m_nest_counter, Partridge_Population_Manager::m_Ourkfactors, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, m_startlayingday, k_factors::m_ThisYear, Clutch_struct::Mum, Partridge_Covey::NestFindLocation(), Clutch_struct::No, pars_FFindingTerritory, pars_FFlocking, pars_FLaying, pars_FMakingNest, Partridge_Communication::PassMessage(), pcomm_MovingHome, pcomm_StoppingBreeding, pob_Clutch, random(), RemoveOldMate(), Partridge_Covey::SetFixed(), Landscape::SupplyDayInYear(), CfgInt::value(), Partridge_struct::x, and Partridge_struct::y.

Referenced by Step().

◆ FPairing()

Partridge_State Partridge_Female::FPairing ( void  )
protected

Female pairing state.

◆ FStartingNewBrood()

Partridge_State Partridge_Female::FStartingNewBrood ( bool  a_waslaying)
protected

Female starting new brood state.

Need to test whether or not to start again.
If it is a brood that is lost then this behaviour is not an option, otherwise we will end here on the loss of a clutch or nest. The data in the lines below needs to be checked if it describes the distribution of 2nd brood sizes. Currently it is the same as 1st clutch minus 4.
See also Partridge_Female::MakingNest

1803 {
1804  m_clutch_number++;
1805  const int clutchsize[19] =
1806  {
1807  // This array holds the probabilities of clutch sizes in 20 categories.
1808  // below from Damerham
1809  143, 385, 725, 1163, 1700, 2336, 3070, 3902, 4833, 5863, 6990, 8217, 9037, 9607, 9928, 10000, 10000, 10000
1810  // The data below is from fitting a 3rd order polynomial to the Danish Paludan 1953 for Danish conditions
1811  // 48, 198, 451, 807, 1266, 1828, 2493, 3261, 4132, 5106, 6182, 7361, 8416, 9208, 9736, 10000, 10000, 10000
1812  };
1813  int today = m_OurLandscape->SupplyDayInYear();
1814  if ( (cfg_par_last_brood_date.value() >= today ) && (m_clutch_number<2)) {
1815  int chance = random( 10000 );
1816  for ( int i = 0; i < 19; i++ ) {
1817  if ( clutchsize[i] > chance ) {
1818  m_clutch_size = cfg_par_min_no_eggs.value() + i - 4; // Subtract 4 to match with UK data for second clutches
1819  break;
1820  }
1821  }
1822  if (!a_waslaying) {
1823  m_nest_counter = 10; // 10 days refraction period (Aebishcher & Potts - loose idea but implemented for want of hard data )
1824  } else m_nest_counter = 1;
1825  return pars_FMakingNest; // Inlcudes finding nest location
1826  }
1827  else {
1828  // Too late or too many attempts
1829 #ifdef __PAR_DEBUG
1831  if ( m_OurLandscape->SupplyDayInYear() < 30 )
1832  {
1833  m_OurLandscape->Warn( "Partridge_Female::FSTartingNewBrood", "Too early" );
1834  exit( 1 );
1835  }
1836 #endif
1837  // tell the male we are giving up
1838  if ( m_MyMate != NULL )
1839  {
1843  }
1844  m_HaveTerritory = false;
1845  m_MyMate = NULL;
1846  m_covey->SetFixed( false );
1847  return pars_FFlocking;
1848  }
1849 }

References cfg_par_last_brood_date, cfg_par_min_no_eggs, CheckMatePointers(), m_clutch_number, m_clutch_size, Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, PartridgeCommunicationData::m_female, m_HaveTerritory, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyMate, m_nest_counter, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, pars_FFlocking, pars_FMakingNest, Partridge_Communication::PassMessage(), pcomm_StoppingBreeding, random(), Partridge_Covey::SetFixed(), Landscape::SupplyDayInYear(), CfgInt::value(), and Landscape::Warn().

Referenced by FIncubating(), FLaying(), OnClutchDeath(), and Step().

◆ GetClutch()

Partridge_Clutch* Partridge_Female::GetClutch ( void  )
inline

Supply clutch pointer.

867  {
868  return m_MyClutch;
869  }

References m_MyClutch.

Referenced by Partridge_Communication::PassMessage().

◆ GetClutchSize()

int Partridge_Female::GetClutchSize ( void  )
inline

´Supply clutch size

862  {
863  return m_clutch_size;
864  }

References m_clutch_size.

◆ GetMate()

◆ GetNestingCoverDensity()

double Partridge_Female::GetNestingCoverDensity ( )
protected

◆ GetOldMate()

Partridge_Male* Partridge_Female::GetOldMate ( void  )
inline

◆ HaveTerritory()

bool Partridge_Female::HaveTerritory ( void  )
inline

◆ KillThis()

virtual void Partridge_Female::KillThis ( void  )
inlinevirtual

Direct mortality message.

Reimplemented from TAnimal.

888  {
889  FDying();
890  }

References FDying().

Referenced by Partridge_Population_Manager::DoFirst().

◆ OnChicksDead()

void Partridge_Female::OnChicksDead ( void  )

Message handler.

Response to pcomm_AllChicksDead message arriving when the last chick dies.

2119 {
2121  m_HaveTerritory = false;
2122  m_MyMate = NULL;
2123 }

References m_HaveTerritory, m_MyMate, Partridge_Base::m_state, and pars_FFlocking.

Referenced by Partridge_Communication::PassMessage().

◆ OnChicksMatured()

void Partridge_Female::OnChicksMatured ( void  )

Message handler.

Response to pcomm_ChicksMature message arriving when the last chick matures.

2108 {
2110  m_MyMate = NULL;
2111  m_HaveTerritory = false;
2112 }

References m_HaveTerritory, m_MyMate, Partridge_Base::m_state, and pars_FFlocking.

Referenced by Partridge_Communication::PassMessage().

◆ OnClutchDeath()

void Partridge_Female::OnClutchDeath ( )

Message handler.

Arrives here follwing a pcomm_ClutchDead or a pcomm_AllInfertile message.

2057 {
2058  if (m_state == pars_FIncubating) {
2059  m_state = FStartingNewBrood(false);
2060  } else m_state = FStartingNewBrood(true);
2061  m_covey->NestLeave();
2062  m_MyClutch = NULL;
2063 }

References FStartingNewBrood(), Partridge_Base::m_covey, m_MyClutch, Partridge_Base::m_state, Partridge_Covey::NestLeave(), and pars_FIncubating.

Referenced by OnClutchMown(), and Partridge_Communication::PassMessage().

◆ OnClutchMown()

void Partridge_Female::OnClutchMown ( )

Message handler.

Arrives here as a result of a pcomm_ClutchMown message. This determines whether the female dies with the clutch.

2070 {
2071  if (m_state==pars_FIncubating) {
2073  {
2074  //Optional output - can depend on the definition of predation in use.
2075  //m_OurPopulationManager->m_Ourkfactors->incNoHensPredated();
2076  FDying();
2077  }
2078  }
2079  OnClutchDeath();
2080 }
static CfgFloat cfg_female_mowing_chance("PAR_FEMALEMOWNMORTALITY", CFG_CUSTOM, 1)
Chance of female death if incubating a mown clutch.
void OnClutchDeath()
Message handler.
Definition: Partridge_All.cpp:2056

References cfg_female_mowing_chance, FDying(), g_rand_uni, Partridge_Base::m_state, OnClutchDeath(), pars_FIncubating, and CfgFloat::value().

Referenced by Partridge_Communication::PassMessage().

◆ OnEggsHatch()

void Partridge_Female::OnEggsHatch ( )

Message handler.

Response to pcomm_EggsHatch message arriving on clutch hatching.

2097 {
2099  m_covey->NestLeave();
2100  m_MyClutch = NULL;
2101 }

References Partridge_Base::m_covey, m_MyClutch, Partridge_Base::m_state, Partridge_Covey::NestLeave(), and pars_FCaringForYoung.

Referenced by Partridge_Communication::PassMessage().

◆ OnFarmEvent()

bool Partridge_Female::OnFarmEvent ( FarmToDo  event)
virtual

Management event handler.

There are only a few management events that cause direct effects for the female, but these may be important eg mowing/cutting events. When she is on the nest mortaltiy is controlled via the Partridge_Clutch object not this code, since she is assumed not to escape so easily (see Partridge_Clutch::AgDying).

Reimplemented from TAnimal.

1492 {
1493  switch ( event )
1494  {
1495  case sleep_all_day:
1496  break;
1497  case autumn_plough:
1498  break;
1499  case autumn_harrow:
1500  break;
1501  case autumn_roll:
1502  break;
1503  case autumn_sow:
1504  break;
1505  case winter_plough:
1506  break;
1507  case deep_ploughing:
1508  break;
1509  case spring_plough:
1510  break;
1511  case spring_harrow:
1512  break;
1513  case spring_roll:
1514  break;
1515 
1516  case spring_sow:
1517  break;
1518  case fp_npks:
1519  break;
1520  case fp_npk:
1521  break;
1522  case fp_pk:
1523  break;
1524  case fp_liquidNH3:
1525  break;
1526  case fp_slurry:
1527  break;
1528  case fp_manganesesulphate:
1529  break;
1530  case fp_manure:
1531  break;
1532  case fp_greenmanure:
1533  break;
1534  case fp_sludge:
1535  break;
1536  case fa_npk:
1537  break;
1538  case fa_pk:
1539  break;
1540  case fa_slurry:
1541  break;
1542  case fa_ammoniumsulphate:
1543  break;
1544  case fa_manure:
1545  break;
1546  case fa_greenmanure:
1547  break;
1548  case fa_sludge:
1549  break;
1550  case glyphosate:
1551  case herbicide_treat:
1552  break;
1553  case growth_regulator:
1554  break;
1555  case fungicide_treat:
1556  break;
1557  case syninsecticide_treat:
1558  case insecticide_treat:
1559  case product_treat:
1560  break;
1561  case molluscicide:
1562  break;
1563  case row_cultivation:
1564  break;
1565  case strigling:
1566  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1567  break;
1568  case hilling_up:
1569  break;
1570  case water:
1571  break;
1572  case swathing:
1573  break;
1574  case harvest:
1575  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1576  break;
1577  case cattle_out:
1578  break;
1579  case cattle_out_low:
1580  break;
1581  case cut_to_hay:
1582  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1583  break;
1584  case cut_to_silage:
1585  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1586  break;
1587  case straw_chopping:
1588  break;
1589  case hay_turning:
1590  break;
1591  case hay_bailing:
1592  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1593  break;
1594  case stubble_harrowing:
1595  break;
1597  break;
1598  case burn_straw_stubble:
1599  break;
1600  case mow:
1601  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1602  break;
1603  case cut_weeds:
1604  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1605  break;
1606  case pigs_out:
1607  break;
1608  case strigling_sow:
1609  if ( g_rand_uni() < cfg_par_ad_cut.value() ) FDying();
1610  break;
1611  default:
1612  m_OurLandscape->Warn( "Partridge_Female::OnFarmEvent(): Unknown event type:",
1613  m_OurLandscape->EventtypeToString( event ) );
1614  exit( 1 );
1615  }
1616  // Must incorporate a test here in case the animal is dead - killing it twice
1617  // can be a bad idea
1618  if ( m_state == pars_Destroy ) return true;
1619  else
1620  return false;
1621 }
static CfgFloat cfg_par_ad_cut("PAR_AD_CUT_MORT", CFG_CUSTOM, 0.01)
Adult % mortality on cutting.
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
@ burn_straw_stubble
Definition: treatment.h:92
@ autumn_harrow
Definition: treatment.h:37
@ swathing
Definition: treatment.h:81
@ fa_pk
Definition: treatment.h:62
@ winter_plough
Definition: treatment.h:42
@ strigling
Definition: treatment.h:77
@ fp_npks
Definition: treatment.h:48
@ glyphosate
Definition: treatment.h:102
@ fa_sludge
Definition: treatment.h:68
@ fp_liquidNH3
Definition: treatment.h:51
@ spring_roll
Definition: treatment.h:46
@ fa_greenmanure
Definition: treatment.h:67
@ spring_plough
Definition: treatment.h:44
@ molluscicide
Definition: treatment.h:75
@ syninsecticide_treat
Definition: treatment.h:99
@ hay_turning
Definition: treatment.h:88
@ autumn_roll
Definition: treatment.h:38
@ fp_manure
Definition: treatment.h:55
@ deep_ploughing
Definition: treatment.h:43
@ pigs_out
Definition: treatment.h:84
@ fa_npk
Definition: treatment.h:61
@ herbicide_treat
Definition: treatment.h:71
@ row_cultivation
Definition: treatment.h:76
@ spring_sow
Definition: treatment.h:47
@ fungicide_treat
Definition: treatment.h:73
@ fp_manganesesulphate
Definition: treatment.h:53
@ harvest
Definition: treatment.h:82
@ cut_to_silage
Definition: treatment.h:86
@ sleep_all_day
Definition: treatment.h:33
@ mow
Definition: treatment.h:93
@ fa_ammoniumsulphate
Definition: treatment.h:65
@ autumn_plough
Definition: treatment.h:34
@ straw_chopping
Definition: treatment.h:87
@ fa_manure
Definition: treatment.h:66
@ fp_greenmanure
Definition: treatment.h:56
@ fa_slurry
Definition: treatment.h:63
@ product_treat
Definition: treatment.h:101
@ stubble_harrowing
Definition: treatment.h:90
@ hilling_up
Definition: treatment.h:79
@ growth_regulator
Definition: treatment.h:72
@ insecticide_treat
Definition: treatment.h:74
@ cattle_out_low
Definition: treatment.h:100
@ cut_to_hay
Definition: treatment.h:85
@ cut_weeds
Definition: treatment.h:94
@ fp_sludge
Definition: treatment.h:57
@ autumn_sow
Definition: treatment.h:41
@ fp_npk
Definition: treatment.h:49
@ fp_pk
Definition: treatment.h:50
@ hay_bailing
Definition: treatment.h:89
@ spring_harrow
Definition: treatment.h:45
@ strigling_sow
Definition: treatment.h:95
@ cattle_out
Definition: treatment.h:83
@ fp_slurry
Definition: treatment.h:52
@ water
Definition: treatment.h:80
@ autumn_or_spring_plough
Definition: treatment.h:91

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, burn_straw_stubble, cattle_out, cattle_out_low, cfg_par_ad_cut, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_greenmanure, fa_manure, fa_npk, fa_pk, fa_sludge, fa_slurry, FDying(), fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_sludge, fp_slurry, fungicide_treat, g_rand_uni, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, herbicide_treat, hilling_up, insecticide_treat, TAnimal::m_OurLandscape, Partridge_Base::m_state, molluscicide, mow, pars_Destroy, pigs_out, product_treat, row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, straw_chopping, strigling, strigling_sow, stubble_harrowing, swathing, syninsecticide_treat, CfgFloat::value(), Landscape::Warn(), water, and winter_plough.

◆ OnMateDying()

void Partridge_Female::OnMateDying ( PartridgeCommunicationData pc_data)

Message handler.

Response to a pcomm_MaleDying message from Partridge_Male::MDying.

2130 {
2131  if ( pc_data->m_male != m_MyMate )
2132  {
2133  m_OurLandscape->Warn( "Partridge_Female::OnMateDying(): ""m_MyMate is not the mate that is dying", "" );
2134  exit( 1 );
2135  }
2136  RemoveOldMate(false);
2137  m_MyMate = NULL;
2138  // What she does now depends on whether the chicks have hatched etc.
2139  switch ( m_state )
2140  {
2141  case pars_FCaringForYoung:
2142  break; // keep doing it
2143  case pars_FFlocking:
2145  break;
2148  break;
2149  case pars_FIncubating:
2150  case pars_FLaying:
2151  //break;
2153  m_MyClutch->OnGivenUp();
2154  m_MyClutch = NULL;
2155  m_covey->SetFixed( false );
2156  m_covey->NestLeave();
2157  break;
2158  case pars_FMakingNest:
2162  m_covey->SetFixed( false );
2163  m_covey->NestLeave();
2164  break;
2165  default:
2166  m_OurLandscape->Warn( "Partridge_Female::OnMateDeath - unknown pars type", NULL );
2167  exit( 1 );
2168  }
2169 }
@ pars_FStartingNewBrood
Definition: Partridge_All.h:282
void OnGivenUp()
Message handler.
Definition: Partridge_All.cpp:631

References Partridge_Base::m_covey, PartridgeCommunicationData::m_male, m_MyClutch, m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_state, Partridge_Covey::NestLeave(), Partridge_Clutch::OnGivenUp(), pars_FAttractingMate, pars_FBuildingUpResources, pars_FCaringForYoung, pars_FFindingTerritory, pars_FFlocking, pars_FIncubating, pars_FLaying, pars_FMakingNest, pars_FStartingNewBrood, RemoveOldMate(), Partridge_Covey::SetFixed(), and Landscape::Warn().

Referenced by Partridge_Communication::PassMessage().

◆ OnMating()

void Partridge_Female::OnMating ( PartridgeCommunicationData pc_data)

Message handler.

Arrives here following pcomm_Mating message from either Partridge_Population_Manager::DissolveCovey or Partridge_Male::MFindingMate.

2032 {
2033  m_MyMate = pc_data->m_male;
2034  RemoveOldMate(false);
2035  SwitchCovey( pc_data->m_covey );
2036  // The state she needs to go to depends on she has a
2037  // territory or not
2038  if ( HaveTerritory() )
2039  {
2042  }
2043  else
2045  m_clutch_number = 0;
2046  m_clutchproduced = false;
2047 }
void SwitchCovey(Partridge_Covey *a_covey)
Swap coveys.
Definition: Partridge_All.cpp:216
bool HaveTerritory(void)
Have we a breeding 'territory'?
Definition: Partridge_All.h:920
Partridge_Covey * m_covey
Definition: Partridge_Communication.h:85

References cfg_buildupwait, HaveTerritory(), m_buildupwait, m_clutch_number, m_clutchproduced, PartridgeCommunicationData::m_covey, PartridgeCommunicationData::m_male, m_MyMate, Partridge_Base::m_state, pars_FBuildingUpResources, pars_FFindingTerritory, RemoveOldMate(), Partridge_Base::SwitchCovey(), and CfgInt::value().

Referenced by Partridge_Communication::PassMessage().

◆ OnSetMyClutch()

void Partridge_Female::OnSetMyClutch ( PartridgeCommunicationData pc_data)

Message handler.

Response to the pcomm_SetClutch message received on Partridge_Clutch object creation.

2087 {
2088  m_MyClutch = pc_data->m_clutch;
2090 }

References PartridgeCommunicationData::m_clutch, m_MyClutch, Partridge_Base::m_state, and pars_FIncubating.

Referenced by Partridge_Communication::PassMessage().

◆ OnWaitForMale()

void Partridge_Female::OnWaitForMale ( )

Message handler.

Called following a pcomm_WaitForMale message from Partridge_Population_Manager::DissolveCovey

2016 {
2017  m_covey->SetFixed( false );
2018  if (m_UncleStatus) {
2019  SetUncleStatus( false );
2020  }
2021  RemoveOldMate(false);
2023 }
bool m_UncleStatus
If has uncle status in the covey.
Definition: Partridge_All.h:416
void SetUncleStatus(bool a_Status)
Set uncle status.
Definition: Partridge_All.h:442

References Partridge_Base::m_covey, Partridge_Base::m_state, Partridge_Base::m_UncleStatus, pars_FAttractingMate, RemoveOldMate(), Partridge_Covey::SetFixed(), and Partridge_Base::SetUncleStatus().

Referenced by Partridge_Communication::PassMessage().

◆ RemoveOldMate()

void Partridge_Female::RemoveOldMate ( bool  a_knockon)
inline

Forget old mate.

903  {
904  if (m_MyOldHusband!= NULL) {
905  if (!a_knockon) { // if it is a knock on then don't start a recursive set of calls
907  }
908  m_MyOldHusband= NULL;
909  }
910  }
void RemoveOldMate(bool a_knockon)
Forget any old mate.
Definition: Partridge_All.cpp:2661

References m_MyOldHusband, and Partridge_Male::RemoveOldMate().

Referenced by FDying(), FMakingNest(), Partridge_Covey::GetUnpairedFemale(), OnMateDying(), OnMating(), OnWaitForMale(), and Partridge_Male::RemoveOldMate().

◆ SetOldMate()

void Partridge_Female::SetOldMate ( Partridge_Male pm)
inline

Set old mate pointer.

898  {
899  m_MyOldHusband=pm;
900  }

References m_MyOldHusband.

Referenced by FLaying().

◆ Step()

void Partridge_Female::Step ( void  )
virtual

Female Step.

The Step code for the female partridge. This is the main state-transition control for the female. It will be called repeatedly each time-step until m_StepDone is set to true.

Reimplemented from TAnimal.

1379 {
1380 
1381  if ( m_CurrentStateNo == -1 || m_StepDone )
1382  return;
1383  switch ( m_state )
1384  {
1385  case pars_Initiation:
1386  case pars_FFlocking:
1387  m_state = FFlocking();
1388  m_StepDone = true;
1389  break;
1392  m_StepDone = true;
1393  break;
1394  case pars_FAttractingMate:
1396  m_StepDone = true;
1397  break;
1400  m_StepDone = true;
1401  break;
1402  case pars_FMakingNest:
1403  m_state = FMakingNest();
1404  m_StepDone = true;
1405  break;
1406  case pars_FLaying:
1407  m_state = FLaying();
1408  m_StepDone = true;
1409  break;
1411  m_state = FStartingNewBrood( false );
1412  m_StepDone = true;
1413  break;
1414  case pars_FIncubating:
1415  m_state = FIncubating();
1416  m_StepDone = true;
1417  break;
1418  case pars_FCaringForYoung:
1420  m_StepDone = true;
1421  break;
1422  case pars_FDying:
1423  m_StepDone = true;
1424  break;
1425  default:
1426  char st[255];
1427  sprintf(st,"%d\n",m_state);
1428  m_OurLandscape->Warn( "Partridge_Female::Step - unknown pars type ", st );
1429  exit( 1 );
1430  }
1431 #ifdef __PAR_DEBUG
1433 #endif
1434 }
@ pars_Initiation
Definition: Partridge_All.h:267
Partridge_State FLaying(void)
Female laying state.
Definition: Partridge_All.cpp:1768
Partridge_State FIncubating(void)
Female incubating state.
Definition: Partridge_All.cpp:1856
Partridge_State FMakingNest(void)
Female making nest state.
Definition: Partridge_All.cpp:1673
Partridge_State FFindingTerritory(void)
Female finding 'territory' state.
Definition: Partridge_All.cpp:1912
Partridge_State FBuildingUpResources(void)
Female building up resources state.
Definition: Partridge_All.cpp:1644
Partridge_State FCaringForYoung(void)
Female caring for young state.
Definition: Partridge_All.cpp:1896
Partridge_State FFlocking(void)
Female flocking state.
Definition: Partridge_All.cpp:1632
Partridge_State FAttractingMate(void)
Female attracting mate state.
Definition: Partridge_All.cpp:1962

References CheckMatePointers(), FAttractingMate(), FBuildingUpResources(), FCaringForYoung(), FFindingTerritory(), FFlocking(), FIncubating(), FLaying(), FMakingNest(), FStartingNewBrood(), TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, Partridge_Base::m_state, TALMaSSObject::m_StepDone, pars_FAttractingMate, pars_FBuildingUpResources, pars_FCaringForYoung, pars_FDying, pars_FFindingTerritory, pars_FFlocking, pars_FIncubating, pars_FLaying, pars_FMakingNest, pars_FStartingNewBrood, pars_Initiation, and Landscape::Warn().

◆ UnSetMate()

void Partridge_Female::UnSetMate ( void  )
inline

Forget mate.

877  {
878  m_MyMate=NULL;
879  }

References m_MyMate.

Member Data Documentation

◆ m_buildupwait

int Partridge_Female::m_buildupwait
protected

Delay before breeding can commence.

Referenced by FBuildingUpResources(), FFindingTerritory(), and OnMating().

◆ m_clutch_number

int Partridge_Female::m_clutch_number
protected

Current clutch attempt.

Referenced by FFindingTerritory(), FLaying(), FStartingNewBrood(), and OnMating().

◆ m_clutch_size

int Partridge_Female::m_clutch_size
protected

Current clutch size.

Referenced by FLaying(), FMakingNest(), FStartingNewBrood(), GetClutchSize(), and Partridge_Female().

◆ m_clutchproduced

bool Partridge_Female::m_clutchproduced
protected

Flag for having produced a clutch.

Referenced by FMakingNest(), and OnMating().

◆ m_HaveTerritory

bool Partridge_Female::m_HaveTerritory
protected

Flag for having found a suitable breeding area.

Referenced by FFindingTerritory(), FMakingNest(), FStartingNewBrood(), HaveTerritory(), OnChicksDead(), OnChicksMatured(), and Partridge_Female().

◆ m_lifespan

int Partridge_Female::m_lifespan
protected

Physiological lifespan in days.

Referenced by BeginStep(), and Partridge_Female().

◆ m_MyClutch

Partridge_Clutch* Partridge_Female::m_MyClutch
protected

◆ m_MyMate

◆ m_MyOldHusband

Partridge_Male* Partridge_Female::m_MyOldHusband
protected

A record of the previous mate if any.

Referenced by GetOldMate(), Partridge_Female(), RemoveOldMate(), and SetOldMate().

◆ m_nest_counter

int Partridge_Female::m_nest_counter
protected

Days spent nest building.

Referenced by FBuildingUpResources(), FMakingNest(), and FStartingNewBrood().

◆ m_startlayingday

int Partridge_Female::m_startlayingday
protected

Records the day laying started.

Referenced by FLaying(), and FMakingNest().

◆ m_triggerlayingvar

int Partridge_Female::m_triggerlayingvar
protected

Adds stochasticity to the light triggering of breeding.

Referenced by FBuildingUpResources(), and Partridge_Female().


The documentation for this class was generated from the following files: